package stu.aistar.day03;

/**
 * for循环
 */
public class ForDemo {
    public static void main(String[] args) {
        for (int i = 65; i < 91; i++) {
            System.out.print((char)i);
        }
        System.out.println();

        int i = 65;
        for (;i<91;){
            System.out.print((char) i);
            i++;
        }
        System.out.println();

        //for循环复合形态...
        //九九乘法表
        for (int p= 1,q=1;p<=9;q++){
            //x代表行，y代表列
            System.out.print(p+"*"+q+"="+p*q+"\t");
            if (p == q){
                System.out.println();
                q = 0;
                p++;
            }
        }

        System.out.println("======嵌套的for======");

        //无关的嵌套
        //外层循环执行一次，内层循环走全部
        for (int m = 0; m < 10; m++) {
            for (int n = 0; n < 25; n++) {
                System.out.print("*");
            }
            System.out.println();
        }

        System.out.println("=======");
        //相关的嵌套
        /*
         *     *
         *     * *
         *     * * *
         *     * * * *
         *     * * * * *
         *
         */
        for (int x = 0; x < 9; x++) {
            for (int y = 0; y <=x; y++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
